package com.auxgroup.hr.front.site.co.personnel;

import com.auxgroup.hr.front.commons.vo.BaseResponseVO;
import com.auxgroup.hr.front.dao.domain.PsCChiguT;
import com.auxgroup.hr.front.dao.domain.PsCEducatTbl;
import com.auxgroup.hr.front.dao.domain.PsCPersonalInfoClass;
import com.auxgroup.hr.front.dozer.IObjectMapper;
import com.auxgroup.hr.front.service.personnal.ChiguTService;
import com.auxgroup.hr.front.service.personnal.EducatTblService;
import com.auxgroup.hr.front.site.co.BaseCO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

/**
 * 持股信息CO
 */
@RestController
@RequestMapping("${auxgroup.hr.contextPath}/chiguT")
public class ChiguTCO extends BaseCO {

	private static final Logger logger = LoggerFactory.getLogger(ChiguTCO.class);

	@Autowired
	private ChiguTService chiguTService;

	@Resource(name = "dozerMapper")
	protected IObjectMapper objectMapper;

	/**
	 * 根据用户id 查询用户所有教育经历
	 * @param emplid
	 * @return
	 */
	@GetMapping(value = "/getAll")
	public BaseResponseVO getAll(String emplid) {
		logger.info("getEducatTbl param= {}", emplid);
		List<PsCChiguT> list = chiguTService.getAll(emplid);
		return buildRespone(list);
	}
	
	/**
	 * 根据用户id 和教育经历编号查询单条教育经历
	 * @param emplid
	 * @param cSeqno
	 * @return
	 */
	@GetMapping(value = "/getOne")
	public BaseResponseVO getOne(String emplid, BigDecimal cSeqno) {
		logger.info("getChiguT param= {}", emplid);
		PsCPersonalInfoClass personalInfo = new PsCPersonalInfoClass(emplid, cSeqno);
		PsCChiguT educatTbl = chiguTService.getOne(personalInfo);
		return buildRespone(educatTbl);
	}

}
